<xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal" ddwrt:oob="true">
  <xsl:import href="/_layouts/xsl/main.xsl"/>
  <xsl:output method="html" indent="no"/>
  <xsl:param name="NoAJAX" select="1"/>
  <!-- Posts summary view (home page view)-->
  <xsl:template name="View_Blog_PostsSummary_RootTemplate" mode="RootTemplate" match="View[List/@TemplateType='301' and (@BaseViewID='7' or @BaseViewID='8' or @BaseViewID='9')]" ddwrt:dvt_mode="root">
    <xsl:apply-templates select="." mode="full" />
  </xsl:template>
  <!-- Links summary view (home page view)-->
  <xsl:template name="View_Blog_LinksSummary_RootTemplate" mode="RootTemplate" match="View[@BaseViewID='4' and List/@TemplateType='103']"  ddwrt:dvt_mode="root">
    <xsl:apply-templates select="." mode="full" />
  </xsl:template>
  <!-- BaseViewID='0' and TemplateType='301' is Home Page view for Blog's posts list -->
  <xsl:template match="View[@BaseViewID='0' and List/@TemplateType='301']" mode="full">
    <xsl:apply-templates select="." mode="RenderView" />
    <xsl:apply-templates mode="footer" select="." />
  </xsl:template>
  <!-- BaseViewID='7' and TemplateType='301' is Posts.aspx view for Blog's posts list -->
  <xsl:template match="View[@BaseViewID='7' and List/@TemplateType='301']" mode="full">
    <xsl:apply-templates select="." mode="RenderView" />
  </xsl:template>
  <!-- BaseViewID='8' and TemplateType='301' is Category.aspx view for Blog's posts list -->
  <!-- BaseViewID='9' and TemplateType='301' is Date.aspx view for Blog's posts list -->
  <xsl:template match="View[(@BaseViewID='8' or @BaseViewID='9') and List/@TemplateType='301']" mode="full">
    <div class = "ms-catviewtitle">
    <h3 class="ms-CategoryTitleMonth">
      <xsl:choose>
        <xsl:when test="@BaseViewID='8'">
            <xsl:if test="$Rows/@value.querystring.Name !=''">
                <xsl:value-of select="$Rows/@resource.wss.blog_posts_category" /><xsl:value-of select="$Rows/@value.querystring.Name" disable-output-escaping="yes"/>
            </xsl:if>
        </xsl:when>
        <xsl:when test="@BaseViewID='9'">
            <xsl:if test="$Rows/@value.querystring.LMY !=''">
                <xsl:value-of select="$Rows/@value.querystring.LMY" disable-output-escaping="yes"/>
            </xsl:if>
        </xsl:when>
      </xsl:choose>
    </h3>
    </div>
    <xsl:choose>
      <xsl:when test="count($Rows/Row[@_ModerationStatus. = 0]) = 0">
        <xsl:if test="@BaseViewID='8'">
            <div class="ms-PostWrapper">
                <xsl:value-of select="$Rows/@resource.wss.blog_category_empty_text" />
            </div>
        </xsl:if>
        <xsl:if test="@BaseViewID='9'">
            <div class="ms-PostWrapper">
                <xsl:value-of select="$Rows/@resource.wss.blog_monthview_empty_text" />
            </div>
        </xsl:if>
      </xsl:when>
      <xsl:otherwise>
        <xsl:apply-templates select="." mode="RenderView" />
        <xsl:apply-templates mode="footer" select="." />
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!-- BaseViewID='0' and TemplateType='302' is Home Page view for Blog's comments list -->
  <xsl:template match="View[@BaseViewID='0' and List/@TemplateType='302']" mode="full">
    <div class="ms-commentsWrapper" >
      <a name="Comments"></a>
      <h3 class="ms-CommentHeader">
        <xsl:value-of select="$Rows/@resource.wss.comments_schema_blg_title"/>
      </h3>
      <xsl:choose>
        <xsl:when test="count($Rows/Row)= 0">
          <div class="ms-commentsempty">
            <xsl:value-of select="$Rows/@resource.wss.comments_xsl_blg_empty_text"/>
          </div>
        </xsl:when>
        <xsl:otherwise>
          <xsl:apply-templates select="." mode="RenderView" />
        </xsl:otherwise>
      </xsl:choose>
    </div>
    <xsl:call-template name="pagingButtons" />
  </xsl:template>
  <!-- BaseViewID='0' and TemplateType='303' is Home Page view for Blog's categories list -->
  <xsl:template match="View[@BaseViewID='0' and List/@TemplateType='303']" mode="full">
    <xsl:if test="$MasterVersion != 4">
        <div class="ms-WPBody">
          <div class="ms-navheader">
            <a href="{$HttpVDir}/{$Rows/@resource.wss.lists_Folder}/{$Rows/@resource.wss.blogcategories_Folder}/AllCategories.aspx">
              <xsl:value-of select="$Rows/@resource.wss.categories_schema_blg_title"/>
            </a>
          </div>
          <table class="ms-navsubmenu2" cellspacing="0" cellpadding="0" border="0" style="width:145px;margin:0px 0px 0px 0px;">
            <xsl:choose>
              <xsl:when test="count($Rows/Row)= 0">
                <tr>
                  <td>
                    <div class="ms-BlogEmptyListText">
                      <xsl:value-of select="$Rows/@resource.wss.blog_empty_list_text"/>
                    </div>
                  </td>
                </tr>
              </xsl:when>
              <xsl:otherwise>
                <tbody>
                  <xsl:apply-templates select="." mode="RenderView" />
                </tbody>
              </xsl:otherwise>
            </xsl:choose>
          </table>
        </div>
        <xsl:if test="$ListRight_AddListItems = '1'">
          <table cellspacing="0" cellpadding="0" width="100%" border="0">
            <tbody>
              <tr>
                <td class="ms-addnew" style="PADDING-BOTTOM: 3px">
                  <span style="vertical-align:middle">
                  <span style="height:11px;width:8px;position:relative;display:inline-block;overflow:hidden;" class="s4-clust"><img src="/_layouts/images/fgimg.png" alt="" style="left:-0px !important;top:-444px !important;position:absolute;"  /></span>
                  <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text>
                  <a class="ms-addnew" id="idBlogHomePageNewCategoryLink"
                     onclick="javascript:NewItem2(event,'{$HttpVDir}/{$Rows/@resource.wss.lists_Folder}/{$Rows/@resource.wss.blogcategories_Folder}/NewCategory.aspx');javascript:return false;"
                     href="{$HttpVDir}/{$Rows/@resource.wss.lists_Folder}/{$Rows/@resource.wss.blogcategories_Folder}/NewCategory.aspx" target="_self">
                    <xsl:value-of select="$Rows/@resource.wss.categories_AddNewCategory" />
                  </a>
                </span>
                </td>
              </tr>
              <tr>
                <td>
                  <img height="5" alt="" src="/_layouts/images/blank.gif" width="1" />
                </td>
              </tr>
            </tbody>
          </table>
        </xsl:if>
    </xsl:if>
    <xsl:if test="$MasterVersion = 4">
    <div class="s4-ql menu vertical">
     <ul class="root static">
      <li class="static">
        <a class="static menu-item" href="{$HttpVDir}/{$Rows/@resource.wss.lists_Folder}/{$Rows/@resource.wss.blogcategories_Folder}/AllCategories.aspx">
            <span class="additional-background">
            <span class="menu-item-text">
              <xsl:value-of select="$Rows/@resource.wss.categories_schema_blg_title"/>
             </span>
             </span>
        </a>
      <ul class="static" style="width:145px;margin:0px 0px 0px 0px;">
        <xsl:choose>
          <xsl:when test="count($Rows/Row)= 0">
                <li class="static">
                  <xsl:value-of select="$Rows/@resource.wss.blog_empty_list_text"/>
                </li>
          </xsl:when>
          <xsl:otherwise>
              <xsl:apply-templates select="." mode="RenderView" />
          </xsl:otherwise>
        </xsl:choose>
        </ul>
        </li>
    </ul>
    <xsl:if test="$ListRight_AddListItems = '1'">
        <a class="static menu-item ms-addnew ms-blog-addnew" id="idBlogHomePageNewCategoryLink" style="text-decoration:none;" 
         onclick="NewItem2(event,'{$HttpVDir}/{$Rows/@resource.wss.lists_Folder}/{$Rows/@resource.wss.blogcategories_Folder}/NewCategory.aspx');return false;"
         href="{$HttpVDir}/{$Rows/@resource.wss.lists_Folder}/{$Rows/@resource.wss.blogcategories_Folder}/NewCategory.aspx" target="_self">
            <span class="additional-background">
                <span class="menu-item-text">
                    <span class="ms-blog-addnew-img">
                        <span style="height:10px;width:10px;position:relative;display:inline-block;overflow:hidden;" class="s4-clust"><img src="/_layouts/images/fgimg.png" alt="" style="left:-0px !important;top:-128px !important;position:absolute;" border="0" /></span>
                    </span>
                    <xsl:value-of select="$Rows/@resource.wss.categories_AddNewCategory" />
                </span>
            </span>
        </a>
    </xsl:if>
    </div>
    </xsl:if>
  </xsl:template>
  <!-- BaseViewID='4' and TemplateType='103' is Home Page view for Blog's links list -->
  <xsl:template match="View[@BaseViewID='4' and List/@TemplateType='103']" mode="full">
      <xsl:if test="$MasterVersion = 4">
        <div class="s4-ql menu vertical">
          <ul class="root static" >
              <li class="static" >
                <a class="static menu-item" href="{$ListUrlDir}/AllItems.aspx">
                <span class="additional-backgroud">
                <span class="menu-item-text">
                    <xsl:value-of select="List/@title" />
                </span>
                </span>
                </a>
                <ul class="static" style="width:145px;margin:0px 0px 0px 0px;">
                  <xsl:choose>
                    <xsl:when test="count($Rows/Row)= 0">
                          <li class="static" style="padding:3px 4px 4px 10px;">
                            <xsl:value-of select="$Rows/@resource.wss.blog_empty_list_text"/>
                          </li>
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:apply-templates select="." mode="RenderView" />
                    </xsl:otherwise>
                  </xsl:choose>
                </ul>
              </li>
          </ul>
          <xsl:if test="$ListRight_AddListItems = '1'">
              <a class="static menu-item ms-addnew ms-blog-addnew" id="idHomePageNewLink" style="text-decoration:none;" 
               onclick="javascript:NewItem2(event, '{$ListUrlDir}/NewForm.aspx');javascript:return false;" 
               href="{$ListUrlDir}/NewForm.aspx" target="_self">
                  <span class="additional-background">
                      <span class="menu-item-text">
                          <span class="ms-blog-addnew-img">
                              <span style="height:10px;width:10px;position:relative;display:inline-block;overflow:hidden;" class="s4-clust"><img src="/_layouts/images/fgimg.png" alt="" style="left:-0px !important;top:-128px !important;position:absolute;" border="0" /></span>
                          </span>
                          <xsl:value-of select="$Rows/@resource.wss.AddNewLink" />
                      </span>
                  </span>
              </a>
          </xsl:if>
        </div>
      </xsl:if>
      <xsl:if test="$MasterVersion != 4">
      <div class="ms-WPBody">
        <div class="ms-navheader">
            <a href="{$ListUrlDir}/AllItems.aspx">
            <xsl:value-of select="List/@title" />
            </a>
        </div>
        <table class="ms-navsubmenu2" cellspacing="0" cellpadding="0" border="0">
          <xsl:choose>
            <xsl:when test="count($Rows/Row)= 0">
              <tr>
                <td>
                  <div class="ms-BlogEmptyListText">
                    <xsl:value-of select="$Rows/@resource.wss.blog_empty_list_text"/>
                  </div>
                </td>
              </tr>
            </xsl:when>
            <xsl:otherwise>
              <tbody>
                <xsl:apply-templates select="." mode="RenderView" />
              </tbody>
            </xsl:otherwise>
          </xsl:choose>
        </table>
      </div>
      <xsl:if test="$ListRight_AddListItems = '1'">
        <table cellspacing="0" cellpadding="0" border="0">
          <tbody>
            <tr>
              <td class="ms-addnew" style="PADDING-BOTTOM: 3px">
                <span style="vertical-align:middle">
                <span style="height:11px;width:8px;position:relative;display:inline-block;overflow:hidden;" class="s4-clust"><img src="/_layouts/images/fgimg.png" alt="" style="left:-0px !important;top:-444px !important;position:absolute;"  /></span>
                <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text>
                <a class="ms-addnew" id="idHomePageNewLink" onclick="javascript:NewItem2(event, '{$ListUrlDir}/NewForm.aspx');javascript:return false;"
                      href="{$ListUrlDir}/NewForm.aspx" target="_self">
                  <xsl:value-of select="$Rows/@resource.wss.AddNewLink" />
                </a>
                </span>
              </td>
            </tr>
            <tr>
              <td>
                <img height="5" alt="" src="/_layouts/images/blank.gif" width="1" />
              </td>
            </tr>
          </tbody>
        </table>
      </xsl:if>
      </xsl:if>
  </xsl:template>
  <xsl:template match="View[List/@TemplateType='301' and (@BaseViewID='0' or @BaseViewID='8' or @BaseViewID='9')]" mode="footer">
    <xsl:call-template name="pagingButtons" />
    <xsl:if test="List/@EnableSyndication=1">
      <div class="ms-blogrss" id="BlogRSSMain">
        <span style="vertical-align:middle">
          <span style="height:16px;width:16px;position:relative;display:inline-block;overflow:hidden;" class="s4-clust"><a href="{$HttpVDir}/_layouts/listfeed.aspx?List={$List}" style="height:16px;width:16px;display:inline-block;" ><img src="/_layouts/images/fgimg.png" alt="{$Rows/@resource.wss.blog_rss_link}" style="left:-0px !important;top:-475px !important;position:absolute;" title="{$Rows/@resource.wss.blog_rss_link}" align="absmiddle" /></a></span>
        </span>
        <a href="{$HttpVDir}/_layouts/listfeed.aspx?List={$List}">
        <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text>
        <xsl:value-of select="$Rows/@resource.wss.blog_rss_link"/>
        </a>
      </div>
      <script type="text/javascript">
        var divBlogRSSNav = document.getElementById("BlogRSSNav");
        var divBlogRSSMain = document.getElementById("BlogRSSMain");
        if (divBlogRSSNav != null &amp;&amp; divBlogRSSMain != null)
        {
        divBlogRSSNav.innerHTML = divBlogRSSMain.innerHTML;
        divBlogRSSNav.className = "ms-blogrssnav";
        divBlogRSSMain.removeNode(true);
        }
      </script>
    </xsl:if>
    <xsl:if test="$EnableAlert">
    <div class="ms-blogrss" >
        <a href="{$HttpVDir}/_layouts/SubNew.aspx?List={$List}&amp;Source={$HttpVDir}%2Fdefault.aspx" longDesc="{$Rows/@resource.wss.ToolBarMenuItemAlertMe}">
          <img src="/_layouts/images/menualert.gif" alt="{$Rows/@resource.wss.ToolBarMenuItemAlertMe}" title="{$Rows/@resource.wss.ToolBarMenuItemAlertMe}" align="absmiddle" height="16px" width="16px"/><xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text><xsl:value-of select="$Rows/@resource.wss.ToolBarMenuItemAlertMe"/>
        </a>
      </div>
    </xsl:if>
  </xsl:template>
  <!-- BaseViewID='0' and TemplateType='301' is Home Page view for Blog's posts list -->
  <xsl:template mode="Item" match="Row[../../@TemplateType='301' and (../../@BaseViewID='0' or ../../@BaseViewID='7' or ../../@BaseViewID='8' or ../../@BaseViewID='9')]">
    <xsl:param name="Fields" select="."/>
    <xsl:param name="Collapse" select="."/>
    <xsl:param name="Position" select="1"/>
    <xsl:param name="Last" select="1"/>
    <!-- Posts.aspx and the home page should show the body of the post -->
    <xsl:variable name="ShowBody"><xsl:if test="../../@BaseViewID='0' or ../../@BaseViewID='7'">1</xsl:if></xsl:variable>
    <!-- Posts.aspx and the home page should show the post date above the posts-->
    <xsl:variable name="ShowTopDate"><xsl:if test="../../@BaseViewID='0' or ../../@BaseViewID='7'">1</xsl:if></xsl:variable>
    <!-- Posts.aspx should show draft posts-->
    <xsl:variable name="ShowDrafts"><xsl:if test="../../@BaseViewID='7'">1</xsl:if></xsl:variable>
    <xsl:variable name="thisNode" select="."/>
    <xsl:if test="$ShowDrafts=1 or $thisNode/@_ModerationStatus. = 0">
      <table>
      <tr class="ms-blogpostdatecol" valign="top">
      <td class= "ms-leftblogdate">
        <div id="PostDateTopBox" class="ms-postcalendardateboxtop">
        </div>
        <xsl:if test="$MasterVersion = 4">
        <div id="PostDateBottomBox" class="ms-postcalendardateboxbottom" style="overflow-x:hidden">
        <div>
        <xsl:value-of select="$thisNode/@PublishedDate.MonthDayOnly" disable-output-escaping="yes" />
        </div>
        </div>
        </xsl:if>
        <xsl:if test="$MasterVersion != 4">
        <div id="PostDateBottomBox" class="ms-postcalendardateboxbottom" style="overflow-x:hidden;font-size:0.8em">
        <div>
        <xsl:value-of select="$thisNode/@PublishedDate.MonthDayOnly" disable-output-escaping="yes" />
        </div>
        </div>
        </xsl:if>      
      </td>
      <td class = "ms-rightblogpost">
        <table dir="None" cellspacing="0" cellpadding="0" width="100%" border="0">
          <tbody>
            <tr>
              <td class="ms-PostTitle">
                <a href="{$HttpVDir}/{$thisNode/../@resource.wss.lists_Folder}/{$thisNode/../@resource.wss.blogpost_Folder}/Post.aspx?ID={$thisNode/@ID}">
                  <xsl:apply-templates select="$Fields[@Name='Title']" mode="PrintField">
                    <xsl:with-param name="thisNode" select="$thisNode"/>
                    <xsl:with-param name="Position" select="$Position"/>
                  </xsl:apply-templates>
                </a>
              </td>
              <!-- Only the Posts.aspx view should show the edit button -->
              <xsl:if test="../../@BaseViewID='7'">
                <!-- Handle _edit only their own_ property on list -->
                <xsl:if test="($thisNode/../@value.listpermission.EditListItems = '1' and (($thisNode/../@value.listpermission.ManageLists  = '1') or ($XmlDefinition/List/@WriteSecurity = '2' and $thisNode/@Author.id = $Userid) or ($XmlDefinition/List/@WriteSecurity != '2')))">
                  <td align="right" class="ms-blogedit">
                    <a href="javascript:" onclick="javascript:ShowPopupDialog('{$HttpVDir}/{$thisNode/../@resource.wss.lists_Folder}/{$thisNode/../@resource.wss.blogpost_Folder}/EditPost.aspx?ID={$thisNode/@ID}&amp;Source={$HttpVDir}%2Fdefault.aspx');">
                      <xsl:value-of select="$thisNode/../@resource.wss.blog_edit" />
                    </a>
                  </td>
                </xsl:if>
              </xsl:if>
            </tr>
          </tbody>
        </table>
        <!-- Show the author, published date and category information below post title -->
        <div class="ms-PostFooter">
          <xsl:for-each select="$Fields">            
            <!-- skip the title field, any note fields (ie: Body), and the field value isn't empty -->
            <xsl:if test="@Name!='Title' and @Type!='Note' and not(@Name='PostCategory' and $thisNode/@PostCategory='')">
              <xsl:choose>
                <!-- For the author field, render it using the span style and preceed it with the word "by"-->
                <xsl:when test="@Name='Author'"><span class="ms-postfootercolor"><xsl:value-of select="$thisNode/../@resource.wss.ByPrefix"/></span><xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text><xsl:value-of select="$thisNode/@Author.span" disable-output-escaping="yes" /></xsl:when>
                <xsl:when test="@Name='PublishedDate'"><xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;&amp;nbsp;</xsl:text><span class="ms-postfootercolor"><xsl:value-of select="$thisNode/../@resource.wss.blog_postfooter_at"/><xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text><xsl:value-of select="$thisNode/@PublishedDate" /></span></xsl:when>                
              </xsl:choose>
            </xsl:if>
        </xsl:for-each>
        <div>
        <xsl:for-each select="$Fields">            
          <xsl:if test="@Name='PostCategory' and not ($thisNode/@PostCategory='')">
            <!-- output the PostCategory field as "Category: " followed by the categories -->
            <xsl:value-of select="$thisNode/../@resource.wss.posts_schema_blgfld_category" /><xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">:&amp;nbsp;</xsl:text><xsl:apply-templates select="$Fields[@Name='CategoryWithLink']" mode="Computed_body"><xsl:with-param name="thisNode" select="$thisNode"/></xsl:apply-templates>
            </xsl:if>
        </xsl:for-each>
        </div>
      </div>
        <xsl:if test="$ShowBody=1">
          <div class="ms-PostBody">
            <div>
              <xsl:apply-templates select="$Fields[@Name='Body']" mode="PrintField">
                <xsl:with-param name="thisNode" select="$thisNode"/>
                <xsl:with-param name="Position" select="$Position"/>
              </xsl:apply-templates>
            </div>
          </div>
        </xsl:if>
        <div class="ms-PostFooter">
          <xsl:for-each select="$Fields">            
            <!-- skip the title field, any note fields (ie: Body), and the field value isn't empty -->
            <!-- skip the title field, any note fields (ie: Body), and the field value isn't empty -->
            <xsl:if test="@Name ='Permalink' or @Name ='EmailPostLink' or @Name ='NumCommentsWithLink'">
            <xsl:choose>
              <!-- print these well known fields, even thought they don't have a value per se-->
              <xsl:when test="@Name='Permalink' or @Name='EmailPostLink' or @Name='NumCommentsWithLink'"><xsl:apply-templates select="." mode="PrintFieldWithDisplayFormLink"><xsl:with-param name="thisNode" select="$thisNode"/><xsl:with-param name="Position" select="$Position"/></xsl:apply-templates><xsl:if test="@Name='Permalink' or @Name='EmailPostLink'"><xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;|&amp;nbsp;</xsl:text></xsl:if></xsl:when>
              <!-- print the rest of the fields as normal if they have a value -->
              <xsl:when test="$thisNode/@*[name()=current()/@Name]!=''"><xsl:apply-templates select="." mode="PrintFieldWithDisplayFormLink"><xsl:with-param name="thisNode" select="$thisNode"/><xsl:with-param name="Position" select="$Position"/></xsl:apply-templates><xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;|&amp;nbsp;</xsl:text></xsl:when>
            </xsl:choose>
            </xsl:if>
          </xsl:for-each>
        </div>
          </td>
    </tr>
    </table>
    </xsl:if>
  </xsl:template>
  <!-- baseviewid = 0 and templatetype='302' is blog's comments list-->
  <xsl:template mode="Item" match="Row[../../@BaseViewID='0' and ../../@TemplateType='302']">
    <xsl:param name="Fields" select="."/>
    <xsl:param name="Collapse" select="."/>
    <xsl:param name="Position" select="1"/>
    <xsl:param name="Last" select="1"/>
    <xsl:variable name="thisNode" select="."/>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" dir="None" class="ms-commenttable">
      <tr>
        <td width="690">
          <h4 class="ms-CommentTitle">
            <xsl:apply-templates select="$Fields[@Name='Title']" mode="PrintField">
              <xsl:with-param name="thisNode" select="."/>
              <xsl:with-param name="Position" select="$Position"/>
            </xsl:apply-templates>
          </h4>
        </td>
        <xsl:if test="($thisNode/../@value.listpermission.EditListItems = '1' and (($thisNode/../@value.listpermission.ManageLists  = '1') or ( $thisNode/@Author.id = $Userid) or ($XmlDefinition/List/@WriteSecurity != '2')))">
          <td align="right" class="ms-blogedit">
            <a href="javascript:" onclick='ShowPopupDialog("{$HttpVDir}/{$thisNode/../@resource.wss.lists_Folder}/{$thisNode/../@resource.wss.blogcomments_Folder}/EditComment.aspx?ID={$thisNode/@ID}&amp;Source={$HttpVDir}/{$thisNode/../@resource.wss.lists_Folder}/{$thisNode/../@resource.wss.blogpost_Folder}/Post.aspx?ID={$thisNode/@PostID}");return false;'>
              <xsl:value-of select="$thisNode/../@resource.wss.blog_edit" />
            </a>
          </td>
        </xsl:if>
      </tr>
    </table>
    <div class="ms-CommentBody">
      <div dir="">
        <xsl:apply-templates select="$Fields[@Name='Body']" mode="PrintField">
          <xsl:with-param name="thisNode" select="."/>
          <xsl:with-param name="Position" select="$Position"/>
        </xsl:apply-templates>
      </div>
    </div>
    <div class="ms-CommentFooter">
      <xsl:value-of select="$thisNode/@Author.span" disable-output-escaping="yes"/><xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text><xsl:value-of select="$thisNode/../@resource.wss.comments_At" /><xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text><span dir="ltr"><xsl:value-of select="$thisNode/@Created"/></span>
    </div>
  </xsl:template>
  <!-- baseviewid = 0 and templatetype='303' is blog's categories list-->
  <!-- BaseViewID='4' and TemplateType='103' is Home Page view for Blog's links list -->
  <xsl:template mode="Item" match="Row[(../../@BaseViewID='0' and ../../@TemplateType='303') or (../../@BaseViewID='4' and ../../@TemplateType='103')]">
    <xsl:param name="Fields" select="."/>
    <xsl:param name="Collapse" select="."/>
    <xsl:param name="Position" select="1"/>
    <xsl:param name="Last" select="1"/>
    <xsl:variable name="thisNode" select="."/>
      <xsl:if test="(../../@BaseViewID='0' and ../../@TemplateType='303')">
        <xsl:if test="$MasterVersion = 4">
          <xsl:for-each select="$Fields">
            <li class="static">
              <xsl:apply-templates select="." mode="PrintField">
                <xsl:with-param name="thisNode" select="$thisNode"/>
                <xsl:with-param name="Position" select="$Position"/>
              </xsl:apply-templates>
            </li>
          </xsl:for-each>
        </xsl:if>
        <xsl:if test="$MasterVersion != 4">
            <tr class="ms-CategoryTitleRow">
                <xsl:for-each select="$Fields">
              <td class="ms-CategoryTitleCell">
                    <xsl:apply-templates select="." mode="PrintField">
                      <xsl:with-param name="thisNode" select="$thisNode"/>
                      <xsl:with-param name="Position" select="$Position"/>
                    </xsl:apply-templates>
              </td>
                </xsl:for-each>
          </tr>
        </xsl:if>
      </xsl:if>
      <xsl:if test="(../../@BaseViewID='4' and ../../@TemplateType='103')">
          <xsl:if test="$MasterVersion != 4">
            <tr class="ms-CategoryTitleRow">
              <xsl:for-each select="$Fields">
              <td class="ms-CategoryTitleCell">
                  <xsl:apply-templates select="." mode="PrintField">
                    <xsl:with-param name="thisNode" select="$thisNode"/>
                    <xsl:with-param name="Position" select="$Position"/>
                  </xsl:apply-templates>
              </td>
              </xsl:for-each>
          </tr>
          </xsl:if>
          <xsl:if test="$MasterVersion = 4">
          <xsl:for-each select="$Fields">
            <li class="static">
              <xsl:apply-templates select="." mode="PrintField">
                <xsl:with-param name="thisNode" select="$thisNode"/>
                <xsl:with-param name="Position" select="$Position"/>
              </xsl:apply-templates>
            </li>
          </xsl:for-each>
          </xsl:if>
      </xsl:if>
  </xsl:template>
  <!-- NumComments from Blog (Posts) => e136aa19-e8d1-1b3c-a32c-aba3e58a971b -->
  <xsl:template name="FieldRef_Blog_NumComments_Lookup_body" match="FieldRef[@ID='e136aa19-e8d1-1b3c-a32c-aba3e58a971b']" ddwrt:dvt_mode="body" mode="Lookup_body">
    <xsl:param name="thisNode" select="."/>
    <xsl:value-of select="$thisNode/@*[name()=current()/@Name]"/>
  </xsl:template>
  <!-- PostCategory from Blog (Posts) => 38bea83b-350a-1a6e-f34a-93a6af31338b -->
  <xsl:template name="FieldRef_Blog_PostCategory_Lookup_body" match="FieldRef[@ID='38bea83b-350a-1a6e-f34a-93a6af31338b']" ddwrt:dvt_mode="body" mode="Lookup_body">
    <xsl:param name="thisNode" select="."/>
    <xsl:value-of select="$thisNode/@*[name()=current()/@Name]" disable-output-escaping="yes" />
  </xsl:template>
  <!-- CategoryID from Blog (Posts) => a194bd80-24e6-e71b-b235-3a283b9f1e71 -->
  <xsl:template name="FieldRef_Blog_CategoryID_Computed_Body" match="FieldRef[@ID='a194bd80-24e6-e71b-b235-3a283b9f1e71']" ddwrt:dvt_mode="body" mode="Computed_body">
    <xsl:param name="thisNode" select="."/>
    <xsl:variable name="nodeval" select="normalize-space($thisNode/@*[name()=current()/@Name])" />
    <xsl:variable name="LookupId" select="normalize-space(substring-before($nodeval,';#'))" />
    <xsl:variable name="LookupValue" select="normalize-space(substring-after($nodeval,';#'))" />
    <a href="{$HttpVDir}/{$thisNode/../@resource.wss.lists_Folder}/{$thisNode/../@resource.wss.blogcategories_Folder}/ViewCategory.aspx?ID={$LookupId}&amp;RootFolder=*">
      <xsl:value-of select="$LookupValue" disable-output-escaping="yes"/>
    </a>
  </xsl:template>
  <!-- Permalink from Blog (Posts) => a194bd80-24e6-e71b-b235-3a283b9f1e71 -->
  <xsl:template name="FieldRef_Blog_Permalink_Computed_Body" match="FieldRef[@ID='a194bd80-24e6-e71b-b235-3a283b9f1e71']" ddwrt:dvt_mode="body" mode="Computed_body">
    <xsl:param name="thisNode" select="."/>
      <span style="vertical-align:middle">
      <span style="height:16px;width:16px;position:relative;display:inline-block;overflow:hidden;" class="s4-clust"><a href="{$HttpVDir}/{$thisNode/../@resource.wss.lists_Folder}/{$thisNode/../@resource.wss.blogpost_Folder}/Post.aspx?ID={$thisNode/@ID}" style="height:16px;width:16px;display:inline-block;" ><img src="/_layouts/images/fgimg.png" alt="{$thisNode/../@resource.wss.posts_permlink_alt}" style="left:-0px !important;top:-412px !important;position:absolute;" title="{$thisNode/../@resource.wss.posts_permlink_alt}" class="imglink" longDesc="{$thisNode/../@resource.wss.posts_permlink_alt}" /></a></span>
      </span>
  </xsl:template>
  <!-- PostedByWithDate from Blog (Posts) => a1944d80-14e6-a71c-b235-3a28329f14b1 -->
  <xsl:template name="FieldRef_Blog_PostedByWithDate_Computed_Body" match="FieldRef[@ID='a1944d80-14e6-a71c-b235-3a28329f14b1']" ddwrt:dvt_mode="body" mode="Computed_body">
    <xsl:param name="thisNode" select="."/>
    <xsl:value-of select="$thisNode/../@resource.wss.blog_posts_postedat_begin"/><xsl:value-of select="$thisNode/@PublishedDate.TimeOnly" disable-output-escaping="yes" /><xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text><xsl:value-of select="$thisNode/../@resource.wss.2000"/><xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text><xsl:value-of select="$thisNode/@Author.span" disable-output-escaping="yes"/>
  </xsl:template>
  <!-- CategoryWithLink from Blog (Posts) => 7b946681-13a6-a72c-b335-3a96b29f1972 -->
  <xsl:template name="FieldRef_Blog_PostCategoryWithLink_Computed_Body" match="FieldRef[@ID='7b946681-13a6-a72c-b335-3a96b29f1972']" ddwrt:dvt_mode="body" mode="Computed_body">
    <xsl:param name="thisNode" select="."/>
    <xsl:param name="value" select="''" />
    <xsl:choose>
      <xsl:when test="$value='' and $thisNode/@PostCategory. != ''">
        <xsl:call-template name="FieldRef_Blog_PostCategoryWithLink_Computed_Body">
          <xsl:with-param name="thisNode" select="$thisNode"/>
          <xsl:with-param name="value" select="normalize-space($thisNode/@PostCategory.)"/>
        </xsl:call-template>
      </xsl:when>
      <xsl:otherwise>
        <!-- 1;#Category 1;#2;#Category 2;#3;#Category 3 -->
        <xsl:variable name="LookupId" select="normalize-space(substring-before($value,';#'))" />
        <xsl:variable name="AfterLookupId" select="normalize-space(substring-after($value,';#'))" />
        <xsl:variable name="LookupValue" select="normalize-space(substring-before($AfterLookupId,';#'))" />
        <xsl:variable name="Leftovers" select="normalize-space(substring-after($AfterLookupId,';#'))" />
        <xsl:variable name="LookupValueFinal">
        <xsl:choose>
          <xsl:when test="$LookupValue != ''">
            <xsl:value-of select="ddwrt:UrlEncode(string($LookupValue))"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="ddwrt:UrlEncode(string($AfterLookupId))"/>
          </xsl:otherwise>
        </xsl:choose>
        </xsl:variable>
        <a href="{$HttpVDir}/{$thisNode/../@resource.wss.lists_Folder}/{$thisNode/../@resource.wss.blogcategories_Folder}/Category.aspx?CategoryId={$LookupId}&amp;Name={$LookupValueFinal}">
          <xsl:choose>
            <xsl:when test="$LookupValue != ''">
              <xsl:value-of select="$LookupValue"/>
            </xsl:when>
            <xsl:otherwise>
              <xsl:value-of select="$AfterLookupId"/>
            </xsl:otherwise>
          </xsl:choose>
        </a>
        <xsl:if test="$Leftovers != ''">
          <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">;&amp;nbsp;</xsl:text>
          <xsl:call-template name="FieldRef_Blog_PostCategoryWithLink_Computed_Body">
            <xsl:with-param name="thisNode" select="$thisNode"/>
            <xsl:with-param name="value" select="$Leftovers"/>
          </xsl:call-template>
        </xsl:if>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!-- NumCommentsWithLink from Blog (Posts) => 65746b4a-13a6-a72c-b815-3a96b29f1f9e -->
  <xsl:template name="FieldRef_Blog_NumCommentsWithLink_Computed_Body" match="FieldRef[@ID='65746b4a-13a6-a72c-b815-3a96b29f1f9e']" ddwrt:dvt_mode="body" mode="Computed_body">
    <xsl:param name="thisNode" select="."/>
      <span style="vertical-align:middle">
      <span style="height:16px;width:16px;position:relative;display:inline-block;overflow:hidden;" class="s4-clust"><a href="{$HttpVDir}/{$thisNode/../@resource.wss.lists_Folder}/{$thisNode/../@resource.wss.blogpost_Folder}/Post.aspx?ID={$thisNode/@ID}" style="height:16px;width:16px;display:inline-block;" ><img src="/_layouts/images/fgimg.png" alt="{$thisNode/../@resource.wss.posts_numcommentswithlink_alt}" style="left:-0px !important;top:-396px !important;position:absolute;" title="{$thisNode/../@resource.wss.posts_numcommentswithlink_alt}" class="imglink" longDesc="{$thisNode/../@resource.wss.posts_numcommentswithlink_alt}" /></a></span>    
      </span>
      <span>
    <a href="{$HttpVDir}/{$thisNode/../@resource.wss.lists_Folder}/{$thisNode/../@resource.wss.blogpost_Folder}/Post.aspx?ID={$thisNode/@ID}">      
    <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text>
    <xsl:value-of select="$thisNode/@NumComments" />
    <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text>
    <xsl:value-of select="$thisNode/../@resource.wss.num_comments_blg_post"/>
    </a>
    </span>
  </xsl:template>
  <!-- EmailPostLink from Blog (Posts) => 1c216b4a-13a6-cd5c-b37b-3776b29ff92e -->
  <xsl:template name="FieldRef_Blog_EmailPostLink_Computed_Body" match="FieldRef[@ID='1c216b4a-13a6-cd5c-b37b-3776b29ff92e']" ddwrt:dvt_mode="body" mode="Computed_body">
    <xsl:param name="thisNode" select="."/>
      <span style="vertical-align:middle">
      <span style="height:16px;width:16px;position:relative;display:inline-block;overflow:hidden;" class="s4-clust"><a href="javascript:navigateMailToLink('{$HttpVDir}%2F{$thisNode/../@resource.wss.lists_Folder}%2F{$thisNode/../@resource.wss.blogpost_Folder}%2FPost.aspx?ID%3D{$thisNode/@ID}')" style="height:16px;width:16px;display:inline-block;" ><img src="/_layouts/images/fgimg.png" alt="{$thisNode/../@resource.wss.posts_emailpostlink_alt}" style="left:-0px !important;top:-267px !important;position:absolute;" title="{$thisNode/../@resource.wss.posts_emailpostlink_alt}" class="imglink" longDesc ="{$thisNode/../@resource.wss.posts_emailpostlink_alt}" /></a></span>
      </span>
  </xsl:template>
  <!-- CategoryWithLink from Blog (Categories) => 7b94c1d8-13a8-a72c-c125-3a96e89f1992 -->
  <xsl:template name="FieldRef_Blog_CategoryWithLink_Computed_Body" match="FieldRef[@ID='7b94c1d8-13a8-a72c-c125-3a96e89f1992']" ddwrt:dvt_mode="body" mode="Computed_body">
    <xsl:param name="thisNode" select="."/>
     <xsl:choose>
     	<xsl:when test="($thisNode/../../@BaseViewID='0' and $thisNode/../../@TemplateType='303' and $MasterVersion = 4)">
	    <a class="static menu-item" href="{$HttpVDir}/{$thisNode/../@resource.wss.lists_Folder}/{$thisNode/../@resource.wss.blogcategories_Folder}/Category.aspx?CategoryId={$thisNode/@ID}&amp;Name={ddwrt:UrlEncode(string($thisNode/@Title))}" id="blgcat{$thisNode/@ID}">
	      <span class="additional-backgroud"><span class="menu-item-text"><xsl:value-of select="$thisNode/@Title"/></span></span>
	    </a>
    	</xsl:when>
    	<xsl:otherwise>
	    <a href="{$HttpVDir}/{$thisNode/../@resource.wss.lists_Folder}/{$thisNode/../@resource.wss.blogcategories_Folder}/Category.aspx?CategoryId={$thisNode/@ID}&amp;Name={ddwrt:UrlEncode(string($thisNode/@Title))}" id="blgcat{$thisNode/@ID}">
	      <xsl:value-of select="$thisNode/@Title"/>
	    </a> 
    	</xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!-- PostTitle from blog (comments) => a131e489-d3d6-4f0c-a152-a3beb89f12be -->
  <xsl:template name="FieldRef_Blog_PostTitle_Lookup_body" match="FieldRef[@ID='a131e489-d3d6-4f0c-a152-a3beb89f12be']" ddwrt:dvt_mode="body" mode="Lookup_body">
    <xsl:param name="thisNode" select="."/>
    <xsl:variable name="nodeval" select="normalize-space($thisNode/@PostTitle.)" />
    <xsl:variable name="LookupId" select="normalize-space(substring-before($nodeval,';#'))" />
    <xsl:variable name="LookupValue" select="normalize-space(substring-after($nodeval,';#'))" />
    <a href="{$HttpVDir}/{$thisNode/../@resource.wss.lists_Folder}/{$thisNode/../@resource.wss.blogpost_Folder}/Post.aspx?ID={$LookupId}&amp;RootFolder=*">
      <xsl:value-of select="$LookupValue"/>
    </a>
  </xsl:template>
  <!-- PostID from blog (comments) => b63172be-d3d6-3f8e-854a-74ef89972eea -->
  <xsl:template name="FieldRef_Blog_PostID_Lookup_body" match="FieldRef[@ID='b63172be-d3d6-3f8e-854a-74ef89972eea']" ddwrt:dvt_mode="body" mode="Lookup_body">
    <xsl:param name="thisNode" select="."/>
    <a href="{$HttpVDir}/{$thisNode/../@resource.wss.lists_Folder}/{$thisNode/../@resource.wss.blogpost_Folder}/Post.aspx?ID={$thisNode/@ID}">
      <xsl:value-of select="$thisNode/@ID"/>
    </a>
  </xsl:template>
</xsl:stylesheet>
